﻿using System;
using System.Collections.Generic;
using System.Web;
using NHOMA2_DVLH.App_Lib.DAL;
using NHOMA2_DVLH.App_Lib.DAL.DuLichLuHanhTableAdapters;

namespace NHOMA2_DVLH.App_Lib.BLL
{
    [System.ComponentModel.DataObject] 
    public class TuyenXeBLL
    {
        private TUYENXETableAdapter tuyenXeAdapter = null;

        public TUYENXETableAdapter TuyenXeAdapter
        {
            get
            {
                if (tuyenXeAdapter == null)
                {
                    tuyenXeAdapter = new TUYENXETableAdapter();
                }
                return tuyenXeAdapter;
            }
            set { tuyenXeAdapter = value; }
        }

        /// <summary>
        /// ndkhoa 13/12
        /// </summary>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethodAttribute
            (System.ComponentModel.DataObjectMethodType.Select, true)]
        public DuLichLuHanh.TUYENXEDataTable GetTuyenXe()
        {
            return TuyenXeAdapter.GetTuyenXe();
        }

        /// <summary>
        /// ndkhoa 13/12
        /// </summary>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethodAttribute
            (System.ComponentModel.DataObjectMethodType.Select, true)]
        public DuLichLuHanh.TUYENXEDataTable GetTuyenXeByMaTuyenXe(int maTuyenXe)
        {
            return TuyenXeAdapter.GetTuyenXeByMaTuyenXe(maTuyenXe);
        }

        /// <summary>
        /// ndkhoa 13/12
        /// </summary>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)] 
        public bool InsertTuyenXe(int? tongThoiGian,
            string khungThoiGian, int? maTramXuatPhat, int? maTramDich)
        {
            return TuyenXeAdapter.InsertTuyenXe(tongThoiGian, khungThoiGian,
                maTramXuatPhat, maTramDich) == 1;
        }

        /// <summary>
        /// ndkhoa 13/12
        /// </summary>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethodAttribute
            (System.ComponentModel.DataObjectMethodType.Delete, true)]
        public bool DeleteTuyenXe(Int32 maTuyenXe)
        {
            bool isOK = TuyenXeAdapter.DeleteTuyenXe(maTuyenXe) == 1;
            return isOK;
        }

        /// <summary>
        /// ndkhoa 13/12
        /// </summary>
        /// <returns></returns>
        [System.ComponentModel.DataObjectMethodAttribute
            (System.ComponentModel.DataObjectMethodType.Update, true)]
        public bool UpdateTuyenXe(int? tongThoiGian,
            string khungThoiGian, int? maTramXuatPhat, int? maTramDich, int maTuyenXe)
        {
            return TuyenXeAdapter.UpdateTuyenXe(tongThoiGian, khungThoiGian,
                maTramXuatPhat, maTramDich, maTuyenXe) == 1;
        }
    }
}
